package com.iraeta.entity.main;

import java.util.ArrayList;

public class TreeNode {
    public String id;
    public String pId;
    public String label;
    public Boolean disabled;
    public ArrayList<TreeNode> children;

    public TreeNode() {
    }

    public TreeNode(String id, String label) {
        this.id = id;
        this.label = label;
        this.children = new ArrayList<>();
        this.disabled = false;
    }

    public void addNode(TreeNode treeNode){
		if(this.children.stream().anyMatch(x-> x.getId().equals(treeNode.id))){
			return;
		}
        this.children.add(treeNode);
        treeNode.pId = this.id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }
}
